<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
if (!session_id()){
    session_start();
}
Route::get('/', function (){
    return view('index');
});
Route::get('/user', function (){
    return view('user');
});
Route::post('/user/update','StudioController@update');
Route::get('/login', function (){
    $action = \Illuminate\Support\Facades\Input::get('action');
    if ($action == 'logout'){
        unset($_SESSION['tianqi_userid']);
    }
    return view('login');
});
Route::post('/get_code', 'StudioController@get_code');
Route::get('/reg', function (){
    return view('register');
});
Route::get('/reg_info', function (){
    return view('register_1');
});
Route::post('/do_reg', 'StudioController@reg');
Route::post('/do_reg_info', 'StudioController@reg_info');
Route::post('/user','StudioController@user_data');
Route::post('/do_login','StudioController@login');
Route::get('/captcha',function(){
    $captcha = new \Laravist\GeeCaptcha\GeeCaptcha(env('CAPTCHA_ID'),env('PRIVATE_KEY'));
    echo $captcha->GTServerIsNormal();
});
Route::post('/upload','UploadController@upload');
Route::post('/savephoto', 'StudioController@save_photo');
